package com.neusoft.weekreport.component.controller;

import com.neusoft.weekreport.component.bizService.BoardBizService;
import com.neusoft.weekreport.component.bizService.ExportWeekToExcelService;
import com.neusoft.weekreport.component.req.ExportBoardInfoReq;
import com.neusoft.weekreport.component.req.ExportWeekInfoReq;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

@RestController
@EnableTransactionManagement
@RequestMapping("/exportBoard")

public class BoardController {
    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Resource
    BoardBizService boardBizService;

    //导出周报到excel
    @RequestMapping(value="/generateBoard",method = RequestMethod.POST)
    public void exportWeekInfo(@RequestBody ExportBoardInfoReq req, HttpServletResponse response){

        try{
            boardBizService.exportBoardInfo(req,response);
        }catch (Exception e){
            logger.error(e.toString());
        }
    }

}